<?PHP
require_once ("./include/membersite_config.php");
$message = '';
$showLogedNavbar = true;
$error = false;
if (! $fgmembersite->CheckLogin ()) {
	$showLogedNavbar = false;
}

if (! $fgmembersite->FetchRanking ()) {
	$error = true;
	$message = "The error is: " . $fgmembersite->GetErrorMessage ();
}
$_SESSION ['id_of_user'] = $fgmembersite->UserId ();
$trivia = false;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv='Content-Type' content='text/html' charset='iso-8859-1' />
<title>Trivia</title>
<?php include 'imports.php'?>
</head>
<body>
<?php if($showLogedNavbar){
 
	include 'navbar.php'; 
}else{
	include 'navbarOutside.php';

}?>


	<div class="container">
		<div class="row clearfix">
			<div id='some_id' class="well">

				<div class='error'>  <?php if($message!=''){ echo "Error: ". $message;}?></div>
				<div>
                	<!--
                    	There are <?php echo $_SESSION['ranking_rows'] ?> rows
                    -->
                <div id="tableMSG">
				<div id="rowMSG">
					<div id="leftIMG">
							<img alt="" src="img/20anivSofOS.png" class="imgMsg">
					</div>
			
					<div id="rightMSG">
					<table class="table table-striped">
						<thead>
							<tr>
								<th>Lugar</th>
								<th>Nombre</th>
								<th>Ptos</th>
							</tr>
						</thead>
						<tbody>  
                        <?php 
                        $sameUserClass="";
                      
							for ($i = 1; $i <= $_SESSION['ranking_rows'] ; $i++) {
								
								if($showLogedNavbar && strcmp ( $_SESSION['ranking'.$i]['name'], $fgmembersite->UserFullName()) == 0 ){
									$sameUserClass="id='sameUser'";
								}else {
									$sameUserClass="";
								}
								
								echo "<tr ".$sameUserClass."> \n";
								echo "<td> " . $i . "</td> \n";
								echo "<td> <i class='icon-user'></i> " . $_SESSION['ranking'.$i]['name'] . "</td> \n";
								echo "<td> " . $_SESSION['ranking'.$i]['points'] . "</td> \n";
								echo "</tr> \n";
							}
						?>
                        </tbody>
					</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
